

Ext.data.DwrDataReader = function(meta, recordType){
    meta = meta || {};
    meta.root='data'; // hardcode the data property
    Ext.data.DwrDataReader.superclass.constructor.call(this, meta, recordType || meta.fields);

};

Ext.extend(Ext.data.DwrDataReader, Ext.data.JsonReader, {

    /**
     * This JsonReader's metadata as passed to the constructor, or as passed in
     * the last data packet's <b><tt>MetaData</tt></b> property.
     * @type Mixed
     * @property meta
     */

    /**
     * This method is only used by a DataProxy which has retrieved data from a remote server.
     * @param {Object} response The XHR object which contains the JSON data in its responseText.
     * @return {Object} data A data block which is used by an Ext.data.Store object as
     * a cache of Ext.data.Records.
     */

    read : function(response){
    	//debugger;
        if(!response) {
            throw {message: "JsonReader.read: Json object not found"};

        }
        if(response.metaData){
            delete this.ef;
            this.meta = response.metaData;
            this.recordType = Ext.data.Record.create(response.metaData.fields);
            this.onMetaChange(this.meta, this.recordType, responses);
        }
        var responseWrapper = response.data?response:{data : response}; 
        if(response.length && !response[this.totalProperty]) {
        	responseWrapper.totalRecords=response.length;
        }
        return this.readRecords(responseWrapper);
    },
    getRoot: function(o) {
    	return o.data;
    }	
});